<%@page import="logger.Log"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>
<f:subview id="step2" >
    <a4j:outputPanel id="foto">
        <h:panelGrid columns="3" >
            <f:facet name="header">
                <h:outputText value="Foto (2/5)" />
            </f:facet>
            <h:outputText value="Foto"/>
            <rich:fileUpload
                fileUploadListener="#{convalidaPaziente.listener}"
                listHeight="50px"
                maxFilesQuantity="#{convalidaPaziente.uplAvb}"
                id="upload"
                allowFlash="false"
                onclear="#{convalidaPaziente.clear()}"
                acceptedTypes="png, jpg"
                >
                <a4j:support event="onuploadcomplete" reRender="image" immediate="true" />
                <a4j:support event="onclear" reRender="upload" immediate="true" />
            </rich:fileUpload>

            <rich:panel id="image" style="text-align: center;">
                <a4j:mediaOutput  element="img" mimeType="image/png" createContent="#{convalidaPaziente.paint}" cacheable="false" 
                                  style="max-height:100px; max-width: 100px; border: 1px solid black;"  >
                    <f:param value="#{convalidaPaziente.timestamp}" name="time"/>
                </a4j:mediaOutput>
            </rich:panel>

            <h:commandLink action="prev" >
                <img src="/PortaleVisite/resources/img/left.png" style="width: 50px" />
            </h:commandLink> 
            <h:commandLink action="next" >
                <img src="/PortaleVisite/resources/img/right.png" style="width: 50px" />
            </h:commandLink>          
        </h:panelGrid>
    </a4j:outputPanel>
</f:subview>